package com.atguigu.controller;

import com.atguigu.pojo.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
@Tag(name = "用户管理", description = "用户管理接口")
public class UserController {
    @Operation(summary = "根据id获取用户信息")
    @GetMapping("/getById")
    public User getUserById(@Parameter(description = "用户id") @RequestParam Long id) {
        //`@Tag`注解用于对接口进行分类，相同`Tag`的接口会放在同一个菜单。
        //`@Operation`用于对接口进行描述。
        //`@Parameter`用于对HTTP请求参数进行描述
        User user = new User();
        user.setId(id);
        user.setName("zhangsan");
        user.setAge(11);
        user.setSex("男");
        return user;
    }
}
